package com.qf.proxy;

import com.qf.service.UserService;
import com.qf.service.impl.UserServiceImpl;

public class UserServiceStaticProxy implements UserService {
    private UserService userService = new UserServiceImpl();
    @Override
    public void insert() {
        System.out.println("开启事务");
        userService.insert();//核心功能
        int i = 10/0;
        try {
            System.out.println("提交事务");
        } catch (Exception e) {
            System.out.println("回滚事务");
            e.printStackTrace();
        }
    }
}
